package com.nuanshui.heatedloan.fund.enums;

import com.google.common.collect.Maps;

import java.util.Map;

/**
 * 支付平台
 * @Author: Gonzo
 * @Date 2017/4/17下午5:55
 * @since 1.4.2
 */
public enum  PlatformEnum {
    PLATFORM_ALI("ALI", "支付宝"),
    PLATFORM_WX("WX", "微信"),
    PLATFORM_YE("YE", "余额"),
    PLATFORM_ALLIN("ALLIN", "通联支付"),
    PLATFORM_BK("BK", "银行卡"),
    PLATFORM_POS("POS", "POS机"),
    PLATFORM_SYS("SYS", "系统"),
    PLATFORM_BATCH("BATCH", "分批"),
    ;

    private static volatile Map<String, String> nameMap = Maps.newConcurrentMap();

    private String name;
    private String desc;

    PlatformEnum(String name, String desc){
        this.desc = desc;
        this.name = name;
    }

    public static String getFullNameByName(String platformName){
        if (nameMap.get(platformName) == null) {
            synchronized (nameMap) {
                if (nameMap.get(platformName) == null) {
                    PlatformEnum[] values = PlatformEnum.values();
                    for(PlatformEnum platformEnum : values){
                        String key = platformEnum.getName();
                        String value = platformEnum.getDesc();
                        nameMap.put(key, value);
                    }
                }

            }
        }
        return nameMap.get(platformName);

    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
